import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { TagDto } from './dto/tag.dto';
import { UpdateTagDto } from './dto/update.tag.dto';
import { TagService } from './tag.service';

@ApiTags('后台管理系统-标签管理')
@Controller('tag')
export class TagController {
  constructor(private readonly tagService: TagService) {}

  @ApiOperation({ summary: '获取所有标签列表' })
  @Get()
  async getTag() {
    return await this.tagService.getTag();
  }

  @ApiOperation({ summary: '创建标签' })
  @Post()
  async createTag(@Body() tagDto: TagDto) {
    return await this.tagService.createTag(tagDto);
  }

  @ApiOperation({ summary: '删除标签' })
  @Delete(':id')
  async deleteTag(@Param('id') id: string) {
    return await this.tagService.deleteTag(id);
  }

  @ApiOperation({ summary: '修改标签' })
  @Put()
  async updateTag(@Body() tagDto: UpdateTagDto) {
    return await this.tagService.updateTag(tagDto);
  }
}
